<?php
class Application_Form_AddFlowerDetail extends Zend_Form
{

	public function init()
	{
		$this->setName('addflowerdetail');

		$slhoa = new Zend_Form_Element_Text('slhoa');
		$slhoa->setLabel('Số lượng hoa :')
		->setRequired(true)
		->addFilter('StripTags')
		->addFilter('StringTrim')
		->addFilter('Int')
		->addValidator('Digits')->addValidator('NotEmpty');
		
		
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setAttrib('id', 'submitbutton');
		
		$reset = new Zend_Form_Element_Reset('reset');
		
		
		//create select connect to loaigiohoa datatable
		$hoa_id= new Zend_Form_Element_Select('hoa_id');
		$hoa_id->setLabel('Tên hoa :');
		$hoa_data= new Application_Model_Hoa();
		$hoa_table=$hoa_data->fetchAll()->toArray();
		foreach ($hoa_table as $value)
		{
			$hoa_id->addMultiOption($value['id'],$value['tenhoa']);
		}
		
		$tengiohoa=new Zend_Form_Element_Text('tengiohoa');
		$tengiohoa->setLabel('Tên giỏ hoa :')
		->setAttrib('readonly', true)
		->setAttrib('class', 'readonly')
		->setRequired(true);

		$this->addElements(array($tengiohoa,$hoa_id,$slhoa,$reset, $submit));
	}
	public function settengiohoa($tengiohoa)
	{
		$this->getElement('tengiohoa')->setValue($tengiohoa);
	}
}